<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:73:"/var/www/html/salary/public/../application/admin/view/staff/contract.html";i:1741932990;s:63:"/var/www/html/salary/application/admin/view/layout/default.html";i:1725591948;s:60:"/var/www/html/salary/application/admin/view/common/meta.html";i:1725591948;s:62:"/var/www/html/salary/application/admin/view/common/script.html";i:1725591948;}*/ ?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
<meta name="referrer" content="never">
<meta name="robots" content="noindex, nofollow">

<link rel="shortcut icon" href="/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">

<?php if(\think\Config::get('fastadmin.adminskin')): ?>
<link href="/assets/css/skins/<?php echo \think\Config::get('fastadmin.adminskin'); ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">
<?php endif; ?>

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
    var require = {
        config:  <?php echo json_encode($config ?? ''); ?>
    };
</script>

    </head>

    <body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
        <div id="main" role="main">
            <div class="tab-content tab-addtabs">
                <div id="content">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <section class="content-header hide">
                                <h1>
                                    <?php echo __('Dashboard'); ?>
                                    <small><?php echo __('Control panel'); ?></small>
                                </h1>
                            </section>
                            <?php if(!IS_DIALOG && !\think\Config::get('fastadmin.multiplenav') && \think\Config::get('fastadmin.breadcrumb')): ?>
                            <!-- RIBBON -->
                            <div id="ribbon">
                                <ol class="breadcrumb pull-left">
                                    <?php if($auth->check('dashboard')): ?>
                                    <li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
                                    <?php endif; ?>
                                </ol>
                                <ol class="breadcrumb pull-right">
                                    <?php foreach($breadcrumb as $vo): ?>
                                    <li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
                                    <?php endforeach; ?>
                                </ol>
                            </div>
                            <!-- END RIBBON -->
                            <?php endif; ?>
                            <div class="content">
                                <div>
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">合同操作</a></li>
    <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">合同记录</a></li>
  </ul>

  <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="home">
        <form id="edit-form" style="margin-top: 20px;" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Name'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="<?php echo htmlentities($row['name'] ?? ''); ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Gender'); ?>:</label>
                <div class="col-xs-12 col-sm-8">

                    <select  id="c-gender" data-rule="required" class="form-control selectpicker" name="row[gender]">
                        <?php if(is_array($genderList) || $genderList instanceof \think\Collection || $genderList instanceof \think\Paginator): if( count($genderList)==0 ) : echo "" ;else: foreach($genderList as $key=>$vo): ?>
                            <option value="<?php echo $key; ?>" <?php if(in_array(($key), is_array($row['gender'])?$row['gender']:explode(',',$row['gender']))): ?>selected<?php endif; ?>><?php echo $vo; ?></option>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>

                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Mobile'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-mobile" data-rule="required" class="form-control" name="row[mobile]" type="text" value="<?php echo htmlentities($row['mobile'] ?? ''); ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Idcard'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-idcard" data-rule="required" class="form-control" name="row[idcard]" type="text" value="<?php echo htmlentities($row['idcard'] ?? ''); ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('CurrentAddress'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-currentAddress" data-rule="required" class="form-control" name="row[currentAddress]" type="text" value="<?php echo htmlentities($row['currentAddress'] ?? ''); ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('PermanentAddress'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-permanentAddress" data-rule="required" class="form-control" name="row[permanentAddress]" type="text" value="<?php echo htmlentities($row['permanentAddress'] ?? ''); ?>">
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Urgent_name'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-urgent_name" data-rule="required" class="form-control" name="row[urgent_name]" type="text" value="<?php echo htmlentities($row['urgent_name'] ?? ''); ?>">
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2"><?php echo __('Urgent_mobile'); ?>:</label>
                <div class="col-xs-12 col-sm-8">
                    <input id="c-urgent_mobile" data-rule="required" class="form-control" name="row[urgent_mobile]" type="text" value="<?php echo htmlentities($row['urgent_mobile'] ?? ''); ?>">
                </div>
            </div>


            <hr/>
            <h3>合同模版</h3>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">入职公司:</label>
                <div class="col-xs-12 col-sm-8">
                    <select class="form-control" data-rule="required" id="company_id" name="row[company_id]">
                        <?php if($companyList): foreach($companyList as $list): ?>
                        <option <?php if($list['id'] == $row['company_id']): ?>selected<?php endif; ?> value="<?php echo $list['id']; ?>"><?php echo $list['name']; ?></option>
                        <?php endforeach; endif; ?>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">合同:</label>
                <div class="col-xs-12 col-sm-8">
                    <input type="hidden" id="default_templateId" value="<?php echo $row['templateId']; ?>">
                    <select class="form-control" data-rule="required" id="templateId" name="row[templateId]">
                    </select>
                    <!-- <a target="_blank" href="/uploads/salary/doc/劳动合同.docx">下载合同模版文件</a> -->
                </div>
            </div>
            <hr/>
            <h3>合同期限</h3>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-2">合同期限:</label>
                <div class="col-xs-12 col-sm-8">

                    <?php 
                        if ($row['contract_start_date']) {
                            $contract_start_date = $row['contract_start_date'];
                        } else {
                            $contract_start_date = date('Y-m-d');
                        }

                        if ($row['contract_end_date']) {
                            $contract_end_date = $row['contract_end_date'];
                        } else {
                            $contract_end_date = date('Y-m-d', strtotime("+1 year"));
                        }

                     ?>

                    <input type="text" class="datetimepicker" id="c-contract_start_date" name="row[contract_start_date]" data-date-format="YYYY-MM-DD" value="<?php echo $contract_start_date; ?>">

                    ～

                    <input type="text" class="datetimepicker" id="c-contract_end_date" name="row[contract_end_date]" data-date-format="YYYY-MM-DD" value="<?php echo $contract_end_date; ?>">
                    <br/>
                    <span id="yinian" style="color:red">“上海申瑞人力资源有限公司-劳动合同”期限为：壹年</span>
                </div>
            </div>
            <div class="form-group shiyongqi_div">
                <label class="control-label col-xs-12 col-sm-2">试用期几个月:</label>
                <div class="col-xs-12 col-sm-8">
                    <?php 
                        if ($row['internship_start_date']) {
                            $internship_start_date = $row['internship_start_date'];
                        } else {
                            $internship_start_date = date('Y-m-d');
                        }

                        if ($row['internship_end_date']) {
                            $internship_end_date = $row['internship_end_date'];
                        } else {
                            $internship_end_date = date('Y-m-d', strtotime("+3 month"));
                        }

                        if (!$row['internship_months']) {
                            $row['internship_months'] = 3;
                        }

                     ?>

                    <input class="shiyongqi" id="c-internship_months" style="width:150px" placeholder="" data-rule="required" min="0" class="form-control" name="row[internship_months]" type="number" value="<?php echo $row['internship_months']; ?>">

                    <br/>

                    <input class="shiyongqi" type="text" class="datetimepicker" id="c-internship_start_date" name="row[internship_start_date]" data-date-format="YYYY-MM-DD" value="<?php echo $internship_start_date; ?>">

                    ～

                    <input class="shiyongqi" type="text" class="datetimepicker" id="c-internship_end_date" name="row[internship_end_date]" data-date-format="YYYY-MM-DD" value="<?php echo $internship_end_date; ?>">
                </div>

            </div>

            <hr style="display:none" class="buchong" />
            <?php if($row['other_data']): foreach($row['other_data'] as $key=>$list): ?>
            <input type="hidden" id="<?php echo $key; ?>" value="<?php echo $list; ?>">
            <?php endforeach; endif; ?>
            <h3 style="display:none" class="buchong" >合同其它参数</h3>
            <div style="display:none" class="buchong" id="buchong_body">
            </div>

            <hr/>
            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-3"><?php if($contract_status_text): ?>合同状态：<span style="color:red"><?php echo $contract_status_text; ?></span><?php endif; ?></label>
                <div class="col-xs-12 col-sm-8">
                    <?php if($contract_status_text != '已签署'): if($row['flowid'] == ''): ?>
                        <button id="submit" type="button" class="btn btn-primary btn-embossed ">生成电子合同</button>
                        <?php else: ?>
                        <button id="submit" type="button" class="btn btn-primary btn-embossed ">重新生成电子合同</button>
                        <button onclick="cancelcontract('<?php echo $row['flowid']; ?>')" type="button" class="btn btn-danger btn-embossed ">仅撤销电子合同</button>
                        <?php endif; endif; ?>
                </div>

            </div>

            <div class="form-group">
                <label class="control-label col-xs-12 col-sm-3"></label>
                <div class="col-xs-12 col-sm-8" style="color:black;font-weight: bold;">
                <?php if($contract_status_text != '已签署' && $row['flowid']): ?>
                   注意：“重新生成电子合同”会将之前已生成的电子合同撤销，然后再生成新的电子合同！
                <?php endif; ?>
                </div>
            </div>
        </form>
        </div>

        <div role="tabpanel" class="tab-pane" id="profile">
                <table style="margin-top: 20px;" class="table table-bordered">
                    <tr>
                        <th>时间</th>
                        <th>合同流</th>
                        <th>合同状态</th>
                        <!-- <th>跟进内容</th> -->
                    </tr>

                    <?php if($contractRecordList): foreach($contractRecordList as $list): ?>
                    <tr>
                        <th><?php echo date("Y-m-d H:i:s", $list['createtime']); ?></th>
                        <th><?php echo htmlentities($list['flowid'] ?? ''); ?></th>
                        <th><?php echo htmlentities($list['contract_status_text2'] ?? ''); ?></th>
                        <!-- <th><?php echo htmlentities($list['content'] ?? ''); ?></th> -->
                    </tr>
                    <?php endforeach; endif; ?>

                </table>
        </div>

</div>

<script type="text/javascript" src="/assets/libs/jquery/dist/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
    var status = 1;
    $('#submit').click(function() {
        if (status == 0) {
            return false;
        }
        status = 0

        $('#edit-form').submit();

        setTimeout(function() {
            status = 1;
        }, '3000');

    });



});

function cancelcontract(flowid) {
    $.post("<?php echo url('staff/cancelcontract'); ?>", {flowid:flowid}, function(res) {
        if (res.code==1) {
            layer.msg(res.msg);
        } else if (res.code == 0) {
            layer.msg('撤销成功！');

            setTimeout(function() {
                // 刷新页面
                window.location.reload();
            }, '2000')
        }
    }, 'json');
}
</script>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script src="/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version'] ?? ''); ?>"></script>
    </body>
</html>
